/*
 * ClassTwo.h
 *
 *  Created on: 2015年7月16日
 *      Author: Administrator
 */

#ifndef BCCH_CLASS2ABIS_H_
#define BCCH_CLASS2ABIS_H_
#include "Class2.h"
//struct ST2ABis_Header{
//	//header 由classType、segment Type组成
//	//2 bits
//	unsigned char classType:2;
//	//4bits
//	unsigned char segmentType:4;
//};

struct ST2ABis_SynchInfo{
	//–系统信息相对super frame的延迟，参见GMR-1 05.002 4 bit
	unsigned char SA_SIRFN_DELAY:4;
	//–系统信息起始的时隙号（二进制），范围(0 - 23)，参见GMR-1 05.002
	//5 bit
	unsigned char SA_BCCH_STN:5;
	//13bits  – Super frame number
	unsigned short superframeNum:13;
	//Multi-frame number 2 bit
	unsigned char MultiframeNum:2;
	//MFFN high bit 1bit> – High bit of the TDMA FN in a multiframe
	unsigned char MFFNHighBit:1;
};

struct ST2Abis_LAInfo{
	//<SA_PCH_CONFIG 2bits> – Paging group configuration information
	unsigned char SA_PCH_CONFIG:2;
	//<SA_BACH_CONFIG 8bits> – Alerting group configuration information
	unsigned char SA_BACH_CONFIG;
	//<RACH_TS_OFFSET 5bits> – Start of RACH window with respect to BCCH (见GMR-1 05.002)，范围0 - 23
	unsigned char RACH_TS_OFFSET:5;
	//<N_Page_Occurrences 2bit> –page初始发射后，其重传的数量，0表示只传延迟
	unsigned char N_Page_Occurrences:2;

	//<IMSI attach-detach ind 1bit> – ATT flag.
	//	0：在当前LA下，MESs不能进行IMSI附着或分离过程
	//	1：在当前LA下，MESs可进行IMSI附着或分离过程
	unsigned char IMSIAttachDetachInd:1;
	//<ECSC indication 1bit> – Early classmark Sending Control。
	//	1：Early sending is explicitly accepted
	//	0：Early sending is explicitly prohibited
	unsigned char ECSCIndication:1;

	//	<SI_update_ind 1bit> – Flag for BACH reorganization. Value changes after each reorganization
	unsigned char SIUpdateInd:1;
};


//BcchNeighbourList1b
struct ST2Abis_BcchNeighbourList1b{	//<ARFCN 11bit>
	unsigned short ARFCN:11 ;
	//<SA_BCCH_STN 5bit>
	unsigned char SA_BCCH_STN:5;
	//<RELATIVE_FRAME_OFFSET 3bit> – 相对于中心SB的帧号偏移
	unsigned char RELATIVE_FRAME_OFFSET:3 ;

};

class Class2Abis :public Class2{
public:
	Class2Abis();
	virtual ~Class2Abis();
public:
//	//头信息 6 bit
//	ST2ABis_Header header;

	//第4类信息的版本号 3bits
	unsigned char class4Ver;
	//<Synch. Info Class 2> – 25 bits
	ST2ABis_SynchInfo synchInfo;
	//<C1 5bits> – 接入系统的功率门限，单位为0.5dB，范围0~15.5dB
	unsigned char selCriterion ;
	//<Misc. Information Class 2> – 4 bits
	//<SB_SELECTION_POWER 4bits> –单位为0.5dB，范围0~6.0dB
	unsigned char miscInfo;
	// – 20 bits，包含的LAI信息，参见GMR-1 05.008
	ST2Abis_LAInfo laInfo;
	/*19 bits，周边SB的BCCH信息。以当前SB为圆心，周边SB的以顺时针排列，正北方SB为第一个，
	 * 存储在BCCH_NEIGHBOUR_LIST1b中，其它5个存储在 BCCH_NEIGHBOUR_LIST2b中
	 * */
	ST2Abis_BcchNeighbourList1b neighbourList;

	/*
	 *Spare – 38 bits
	The frame number FN refers to the frame in which Segment 2Abis is transmitted.
	Using the MFFN high bit the MES knows the position of the BCCH burst within
	a group of 8 frames (see GMR-1 05.002)。The MES can derive the correct frame number knowing
	that the BCCH burst always occurs in (2+SA_SIRFN_DELAY)mod 8.
	 * */
	unsigned char spare[5];

};

#endif /* BCCH_CLASS2ABIS_H_ */
